=> Code for subword segmentation using SentencePiece 

import sentencepiece as spm
spm.SentencePieceTrainer.train('--input=data1/mt/eng-to-mal/src-train.txt --model_prefix=data1/mt/word/eng-to-mal/src --vocab_size=2000')
spm.SentencePieceTrainer.train('--input=data1/mt/eng-to-mal/tgt-train.txt --model_prefix=data1/mt/word/eng-to-mal/tgt --vocab_size=2000')

=> Generate Vocabularies for OpenNMT using config file
!python build_vocab.py -config "eng-to-mal-config.yaml" -n_samples -1 -src_vocab_size 2000 -tgt_vocab_size 2000

=> Train your transformer model 
!nohup python train.py -config "./Config Files/eng-to-mal-config.yaml" 2> ./logs/model_running_logs/eng2mal.txt

=> Test your saved model on Testing data
!python translate.py -model path-to-saved-model/model_name.pt -src path-to-sourcelanguage-test-data  -output path-to-output-file-to-store-translations -gpu 0